﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.NodeMsg.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.Api
{
    [ApiRouteName("/flow/node/msg/{name}")]
    internal class FlowNodeMsgApi : ApiController
    {
        private readonly IFlowNodeMsgService _Service;

        public FlowNodeMsgApi ( IFlowNodeMsgService service )
        {
            this._Service = service;
        }

        public FlowNodeMsg[] Gets ( [NumValidate("flow.node.id.error", 1)] long nodeId )
        {
            return this._Service.Gets(nodeId);
        }
        public FlowNodeMsgData Get ( [NumValidate("flow.node.msg.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }
        public void Delete ( [NumValidate("flow.node.msg.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }
        public void Add ( NodeMsgSet datum )
        {
            this._Service.Add(datum);
        }
        public bool Set ( LongParam<NodeMsgSet> param )
        {
            return this._Service.Set(param.Id, param.Value);
        }
    }
}
